/**
 * 用户列表 add by gsh
 */
$(function() {
	$("#chkAll").change(function() {
		var chkStatus = $(this).is(":checked");
		$("[id^=chk]:not(#chkAll)").each(function() {
			this.checked = chkStatus;
		});
	});
});

function getChecked() {
	var map = $("[id^=chk]:not(#chkAll)").map(function() {
		if (this.checked)
			return this.value;
	});
	return map.get();
}

//通过
function pass(mid) {
	var index = msgWnd.confirm("确认通过吗?", {
		title : "合作伙伴申请审核",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {
		$.ajax({
			type : "POST",
			url : "/partner/audit/pass/"+mid,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status == 1) {
					msgTools.alert("合作伙伴申请审核", "审核成功。", 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;
				}else if(msg.data.status == -1) {
					msgTools.alert("合作伙伴申请审核", "审核失败。该会员在此地区已是该级别合作伙伴！", 1000);
				}else {
					msgTools.alert("合作伙伴申请审核", "审核失败。", 1000);
				}
			}
		});	
		msgWnd.close(index);
	});	
}

//拒绝
function refuseDlg(mid) {
	var index = msgWnd.open({
		title : "合作伙伴申请审核",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "610px", "380px" ],
		maxmin : true,
		content : '/partner/audit/msg/' + mid,
		zIndex : layer.zIndex
	});
}

//编辑
function edit(id) {
	var index = msgWnd.open({
		title : "修改合作伙伴信息",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "610px", "380px" ],
		maxmin : true,
		content : '/partner/edit/' + id,
		zIndex : layer.zIndex
	});
}

function viewUser(id) {
	var index = msgWnd.open({
		title : "查看用户信息",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "550px" ],
		maxmin : true,
		content : '/user/view/' + id,
		zIndex : layer.zIndex
	});	
}
